package jas.bank;

import jas.rpc.server.cluster.ReadOnly;
import java.io.Serializable;

/**
 * Represents an Account on the server side.
 */
public class AccountImpl implements Account, Serializable {
    
    private String name;
    private double balance;

    public AccountImpl(String name) {
        this.name = name;
        this.balance = 0;
    }
    
    @ReadOnly
    public String getName() {
        return name;
    }
    
  //  @ReadOnly
    public double getBalance() {
        return balance;
    }

    public synchronized void deposit(Double amount) {
        balance += amount;
    }

    public synchronized void withdraw(Double amount) {
        balance -= amount;
    }

}
